From: Florian Müllner Date: Mon, 17 Sep 2012 18:50:27 +0000 (+0200) Subject: history: Allow events to bubble up when arrowing past the first/last item X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5828 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2c130c866889a39f29ffaff3c8773aa9a40318e6;p=gnome-shell.git history: Allow events to bubble up when arrowing past the first/last item Currently the HistoryManager consumes all arrow up/down key presses unconditionally. Change this to only consume the event if the entry text was actually changed, e.g. not when trying to move past the first/last item. https://bugzilla.gnome.org/show_bug.cgi?id=682243 --- diff --git a/js/misc/history.js b/js/misc/history.js index 5cb82823a..5d499f863 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -41,24 +41,26 @@ const HistoryManager = new Lang.Class({ this._historyIndex = this._history.length; }, - prevItem: function(text) { + _setPrevItem: function(text) { if (this._historyIndex <= 0) - return text; + return false; if (text) this._history[this._historyIndex] = text; this._historyIndex--; - return this._indexChanged(); + this._indexChanged(); + return true; }, - nextItem: function(text) { + _setNextItem: function(text) { if (this._historyIndex >= this._history.length) - return text; + return false; if (text) this._history[this._historyIndex] = text; this._historyIndex++; - return this._indexChanged(); + this._indexChanged(); + return true; }, lastItem: function() { @@ -83,11 +85,9 @@ const HistoryManager = new Lang.Class({ _onEntryKeyPress: function(entry, event) { let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_Up) { - this.prevItem(entry.get_text()); - return true; + return this._setPrevItem(entry.get_text()); } else if (symbol == Clutter.KEY_Down) { - this.nextItem(entry.get_text()); - return true; + return this._setNextItem(entry.get_text()); } return false; }, @@ -98,8 +98,6 @@ const HistoryManager = new Lang.Class({ if (this._entry) this._entry.set_text(current); - - return current; }, _save: function() {